home *** CD-ROM | disk | FTP | other *** search
- Interleaving on the AT&T PC6300
-
- The WDRAM utility was written in response to a long discussion about
- disk performance on Scott Pazur's Flea Markey BBS (201-446-1665).
-
- Like most PC owners, I hadn't given any thought to disk performance since
- there didn't seem to be much I could do. Also, like most owners, I'd let
- the computer store which sold me my machine format it and set it up. Not
- suprisingly, they used the default low-level formatting procedure.
-
- The Western Digital controller (WX2) and a Seagate 20MB disk were formatted
- with an interleave of 3. A program, SPINTEST, available on the BBS showed
- that disk performance was dismal.
-
-
-
- The following comments are technical background for WDRAM and its operation.
-
- ---- Why Interleave?
- Controllers interleave because they cannot transfer data to memory
- as fast as they can read it off the disk. Some controllers won't
- transfer anything unless the error check codes are correct which
- cannot be determined until after the entire sector is read.
-
- If the sectors were placed sequentially on disk, after reading one
- sector, there would not be enough time to transfer it before the next
- one came along under the read heads. (Obviously, the disk isn't going
- to stop spinning just because the controller isn't ready.) By putting
- sequential sectors the proper distance apart, the desired sector is
- just about to be read when the controller is ready to process it.
-
-
- ---- What is wrong with having the wrong interleave?
- With the proper interleave, after reading and transferring sector 'n',
- sector 'n+1' is just about to come by. If the interleave is too large,
- we'll have to skip over at least one sector which is not 'n+1'. This will
- waste whatever time it takes to skip over that sector. If the interleave
- is too small, we've already missed sector 'n+1'. We must wait a whole
- revolution of the disk before we get another shot at it. If we were to read
- all 17 sectors (on a normal disk), we'd require 17 revolutions.
-
-
- ---- What should the PC6300 interleave be?
- If you have the standard WD disk controller, an interleave of 6 works best.
- This is readily verified with a number of public domain disk test programs.
-
- An interleave of 6 requires 6 revolutions to read one track.
-
-
- ---- What's different about the PC6300?
- The AT&T PC6300 uses a 16 bit processor the 8086 (or V30 for you hacks).
- It is functionally equivalent to the processor used in true blue PCs, but it
- has a 16 bit external bus, not 8. The main AT&T peripherals: ROM, RAM and
- CRT are all on this 16 bit bus.
-
- The IBM PC uses an 8 bit bus internally. This means that two bus cycles
- are required to move 16 bits anywhere. The I/O bus is just an extension
- of the internal bus. It is only 8 bits wide.
-
- The WD disk controller is an 8 bit controller, designed to operate on the
- 8 bit IBM bus.
-
-
- ---- How does the PC6300 squeeze 16 bits onto an 8 bit bus?
- The PC6300 has a 'bus converter board'. Whenever an 8 bit reference is
- made to the 8 bit I/O bus, this board automatically routes the proper 8 of
- 16 data bits. When a 16 bit reference is made, however, it stops the CPU
- and generates two 8 bit transfers itself. Needless to say, this takes
- quite a bit of time.
-
-
- ---- Another suprise!
- The bus converter board runs at half/speed; the CPU zips along at 8MHz.
- This normally allows 16 bits in/out (to RAM anyway) every 0.5 microsecond.
- Intel has this nice thing called peripheral clocks (PCLK) which is always
- half of the CPU speed. Consequently, the DMA channels run at 4 MHZ. Piling
- this slowdown on top of the bus converter makes 16 bit accesses very painful.
-
-
- ---- Why should I care? (or, Insult to injury!!)
- WD provides its own ROM BIOS. This code is init'd at IPL time (assuming
- you see the Optional ROM at C800:0000 message). He takes over a few vectors.
- When DOS wants to do hard disk I/O, it calls the WD ROM BIOS. Since the
- 8086 is fetching instructions 16 bits at a pop, the bus converter board is
- very busy. The end result is that the CPU runs at a snail's pace compared to
- what it could do if it ran from RAM.
-
-
- ---- The elegant solution??
- A new machine.
-
-
- ---- The dirty solution....
- WDRAM is a TSR program which attempts to replicate the WD ROM BIOS in RAM
- where things can run at top speed. The WD ROM code that is placed in
- your WD controller card is copied to RAM. Then things are patched up
- so that the RAM copy gets control and not the ROM version.
-
-
- ---- What does WDRAM do?
- WDRAM just copies the ROM code you've been using all along but runs it out
- of RAM at higher speeds. The speedup is so large that you can now run
- with an interleave of 4! This yields a spintest transfer rate of 130KB/sec
- (interleave=4) vs. 89KB/sec (interleave=6), a 46% improvement.
- Of course, you will have to do another low-level format to change your
- interleave. (Booting and running WITHOUT WDRAM does terribly: with my
- 4 interleave, it took takes 18 spintest revolutions to read a track.)
-
-
- ---- How does WDRAM do it?
- The start of the WD ROM BIOS code is a fixed pattern, Hex 55,AA,10.
- At IPL time, the ROM BIOS jumps to C800:0003. WD places a JMP here
- which leads to the initialization code. That initialization code takes
- over a number of vectors, including those at 0000:004C and 0000:0064.
- Then it initializes the controller and disks.
-
- When DOS boots, it also takes over 0000:004C and 0000:0064. DOS saves
- the original contents (now C800:???? and C800:????) in its private RAM
- before stuffing other addresses into these vector locations.
-
- WDROM performs several things:
- 1. WDRAM makes a RAM copy of the original WD BIOS.
- 2. WDRAM scans the WD BIOS to find out what is initially placed in
- locations 0000:004C and 0000:0064. (We can't look there anymore,
- since DOS and who-know-what-other TSRs have since modified them.)
- 3. WDRAM then scans DOS looking for the original addresses.
- 4. WDRAM patches the DOS' version of these addresses to refer to the
- equivalent location in RAM. Thus, when DOS goes to pass a request
- the the WD ROM BIOS, it calls the now-patched area and we execute
- out of RAM.
- 5. WDRAM does a TSR number, leaving only the RAM copy of WD BIOS. This
- will eat about 2K bytes (plus PCP).
-
-
- ---- What's next?
- I'll keep tweeking the DMA programming (demand vs single mode) to see if I
- can't get the interleave down to 3. In the meantime, if anyone has a
- different version of the WDC which does not work with WDRAM (on PC6300 only,
- please), let me know & we'll check out its init code and update WDRAM.
-
-
-
- ---- Thanks for Bulletin Boards!!
- I'd never have known how wastefully my machine was operating if it hadn't
- been for The Flea Market (201-446-1665). Some member posted a message which
- got this whole thing rolling (and spinning faster!!).
-
-
-
-
-
- Chris Smith
- 115 Hanover Road
- Newtown, CT 06470.
-
- 203-426-0024.
-